Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add implementation of unified vault format (UVF). #16623

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft

Conversation

chenkins
Copy link
Collaborator

@chenkins chenkins commented Dec 6, 2024

@chenkins chenkins force-pushed the feature/uvf branch 2 times, most recently from 4730d93 to 13bfc8d Compare December 6, 2024 15:54
@chenkins chenkins requested a review from ylangisc December 6, 2024 17:00
@dkocher dkocher linked an issue Dec 9, 2024 that may be closed by this pull request
@chenkins chenkins changed the title First ideas for uvf imple. Add implementation of unified vault format Feb 27, 2025
@chenkins chenkins changed the title Add implementation of unified vault format Add implementation of unified vault format (UVF) Feb 27, 2025
@chenkins chenkins changed the title Add implementation of unified vault format (UVF) Add implementation of unified vault format (UVF). Feb 27, 2025
dkocher

This comment was marked as outdated.

Copy link
Contributor

@dkocher dkocher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Should destroy master key when closing vault.
  • Ensure master key is loaded in load only using password callback and not passed in constructor.

Comment on lines +83 to +89
if(new SimplePathPredicate(home).test(directory)) {
// TODO hard-coded to initial seed in UVFVault
directoryIdHash = filenameCryptor.hashDirectoryId(id);
}
else {
directoryIdHash = vault.getCryptor().fileNameCryptor(loadRevision(session, directory)).hashDirectoryId(id);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ylangisc what's the best approach - should we cache the revisions per directory along with its ID?

Comment on lines +156 to +158
// TODO still fails as test data from org.cryptomator.cryptolib.v3.UVFIntegrationTest uses latestSeed when creating dir.uvf, hard-coded in current implementation for subdir in DirectoryMetadata subDirMetadata = dirContentCryptor.newDirectoryMetadata();)
final AttributedList<Path> list = storage.getFeature(ListService.class).list(new Path("/cyberduckbucket/subdir", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted)).withAttributes(subdir), new DisabledListProgressListener());
assertEquals(1, list.size());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ylangisc with the loadRevision workaround, the encryption part of the subdir works and the raw folder is listed remotely, but then fails in AbstractVault.decrypt when attemptyting to decrypt the file name, probably due to the file name decryptor statically linked to the initial revision. Need to continue there.

final Path metadataFile = new Path(metadataParent, vault.getDirectoryMetadataFilename(), EnumSet.of(Path.Type.file, Path.Type.encrypted));
final byte[] ciphertext = new ContentReader(session).readBytes(metadataFile);
// https://github.com/encryption-alliance/unified-vault-format/blob/develop/file%20name%20encryption/AES-SIV-512-B64URL.md#format-of-diruvf-and-symlinkuvf
// TODO can we not use org.cryptomator.cryptolib.v3.DirectoryContentCryptorImpl.decryptDirectoryMetadata()? DirectoryMetadataImpl is not visible and DirectoryMetadata is empty interface, so we cannot access dirId attribute.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@overheadhunter how can we use cryptolib API to read UVf metadata file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use DirectoryMetadataImpl#cast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add implementation of unified vault format
3 participants